//
//  NetConnection.h
//  LegoClient
//
//  Created by Balazs Faludi on 02.01.10.
//  Copyright 2010 Universität Basel. All rights reserved.
//

#import <Foundation/Foundation.h>

#define kNetConnectionPingHeader @"NetConnectionPing "

@protocol NetConnectionDelegate;

@class NetMessage;

@interface NetConnection : NSObject {
	NSInputStream *_inputStream;
	NSOutputStream *_outputStream;
	NSMutableData *_currentDownload;
	NSMutableData *_currentUpload;
	BOOL _outputHasSpaceAvailable;
	NSString *delimiter;
	NSObject <NetConnectionDelegate> *delegate;
}

@property (nonatomic, retain) NSString *delimiter;
@property (nonatomic, retain) NSObject <NetConnectionDelegate> *delegate;

- (id)initWithInputStream:(NSInputStream *)inputStream outputStream:(NSOutputStream *)outputStream;
- (void)sendMessage:(NetMessage *)message;

@end


@protocol NetConnectionDelegate

- (void)connection:(NetConnection *)connection receivedMessage:(NetMessage *)message;
- (void)connectionLost:(NetConnection *)connection;

@end